<template>
  <div class="tuijianbox">
    <div class="quanbu">
      <QuanBu />
    </div>
    <div class="content" v-for="item in listArray" :key="item.shortName">
      <div class="top">
        <div class="top-left">
          <img :src="item.icon" alt="" />
          <span>{{ item.tabName }}</span>
          <span>{{ item.tabName }}</span>
        </div>
        <div class="top-right" @click="tuijiantz(item);">
          <span>更多</span>
          <img
            src="https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/icon-more_6c08756.png"
            alt=""
          />
        </div>
      </div>
      <ul class="matter">
        <li v-for="mr in item.list" :key="mr.nickname" @click="dizhi(mr.rid)">
          <lazy-component>
               <img :src="mr.roomSrc" alt="" v-lazy="mr.roomSrc" />
          </lazy-component>
          <p>{{ mr.roomName }}</p>
          <div class="reqi">
            <img
              src="https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/iconfont-wo_fdcada2.png"
              alt=""
            />
            <span>{{ mr.nickname }}</span>
          </div>
          <div class="user">
            <img
              src="https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/hotnum_6b05e5d.png"
              alt=""
            />
            <span>{{ mr.hn }}</span>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getTtuiJianList } from "@/api/roomList";
import QuanBu from "@/components/QuanBu.vue";
export default {
  data() {
    return {
      listArray: [],
    };
  },
  created() {
    this.shuju();
  },
  methods: {
    async shuju() {
      let res = await getTtuiJianList();
      console.log(res);
      this.listArray = res.data;
    },
    tuijiantz(item){
      this.$router.push({
        name:'QeiHuan',
        query:{
          qh:item.shortName,
           name:item.tabName
        },
      });
    },
    dizhi(id){
     window.location.href=`https://www.douyu.com/room/share/${id}`;   
    }
  },
  components: { QuanBu },
};
</script>

<style lang="scss" scoped>
.tuijianbox {
  width: 7.8rem;

  .top {
    width: 7.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.8rem;
    .top-left {
      width: 3.5rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      img {
        width: 0.4rem;
      }
      span {
        font-size: 0.3rem;
      }
      span:nth-of-type(2) {
        border: .01rem solid #ff5218;
        height: .3rem;
        font-size: 0.25rem;
        padding: 0.1rem;
        border-radius: 0.3rem;
        color: #ff5218;
      }
    }
    .top-right {
      display: flex;
      justify-content: space-between;
      width: 0.9rem;
      span {
        font-size: 0.25rem;
      }
      img {
        width: 0.3rem;
      }
    }
  }
  .matter {
    width: 7.8rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    li {
      width: 3.7rem;
      margin-top: 0.2rem;
      position: relative;
      .reqi {
        position: absolute;
        bottom: 0.5rem;
        left: 0.1rem;
        img {
          width: 0.3rem;
        }
        span {
          font-size: 0.3rem;
          color: #fff;
        }
      }
      .user {
        position: absolute;
        top: 0.1rem;
        right: 0.1rem;
        img {
          width: 0.3rem;
        }
        span {
          font-size: 0.3rem;
          color: #fff;
        }
      }
      img {
        width: 100%;
        border-radius: .1rem;
      }
      p {
        font-size: 0.28rem;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }
}
</style>